<script setup>
// readonly：用来定义只读数据，当改变的时候会给出一个警告，无法进行数据的修改
import { readonly } from 'vue'

let state = readonly({
  name: '张三丰'
})

function changeName() {
  state.name = '李四'
}

</script>
<template>
  <div>
    <h1> {{ state.name }} </h1>
    <button @click="changeName">修改</button>
  </div>
</template>